#include <stdio.h>

/**
 * 检测是否为回文
 */
int is_palindrome(char *str) {
    char *p = str;
    int len = 0;

    while(*p) {
        p++;
    }

    int i = 0;
    len = p - str; 
    p--;

    while(i < len / 2) {

        if (*str != *p) {
            return -1;
        }
        str++;
        p--;
        i++;
    }

    return 0;
}

int main(int argc, char *argv[])
{
    char input[100] = {0};
    printf("please input your string:");
    scanf("%s", input);

    int result = 0;
    result = is_palindrome(input);

    if (result) {
       printf("not palindrome.\n"); 
    } else {
        printf("yes, it's palindrome: %s\n", input);
    }

    return 0;
}
